
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Ajax_Controller extends CI_Controller {
 
    function __construct()
    {
        parent::__construct();
        $this->load->database();
        $this->load->helper('url');
    }
 
    public function getPartialPaymentByUser()
    {
        $id= $this->input->post('id',true);
        $array = array();
        if($id!=false)
        {
            $this->load->model('Bill_Model');
            $result=$this->Bill_Model->getAllBillsByUserId($id);
            foreach($result as $row)
            {
                 $array[] = array("value" => $row->FAC_ID, "property" => $row->FAC_FECHAFACTURACION);
            }
        }
        echo json_encode($array);
        exit;
    }
    
    public function getDataBillByUser()
    {
        $bill_number= $this->input->post('bill_number',true);
        $identy_card= $this->input->post('identy_card',true);
        $enrollment_number= $this->input->post('enrollment_number',true);
        $bill_date= $this->input->post('bill_date',true);
        $bill_total= $this->input->post('bill_total',true);
        $array = array();
        if($bill_number!=false&&$identy_card!=false&&$enrollment_number!=false&&$bill_date!=false&&$bill_total!=false)
        {
                $array[] = array("value" =>"1" , "property" => "prueba");
                $data = array();
                $this->load->library('ciqrcode');
                $params['data'] = $bill_number.'*'.$identy_card.'*'.$enrollment_number.'*'.$bill_date.'*'.$bill_total;
                $params['level'] = 'M';
                $params['size'] = 10;
                //cargar y modificar el qr del usuario
                $params['savename'] = FCPATH.'assets/qr_user_code/qr.png';
                $this->ciqrcode->generate($params);
        }
        echo json_encode($array);
        exit;
    }
}
 